package com.qf.annotation;

import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @author zjw
 * @description
 * @date 2021/9/28$ 10:23$
 */
@Component     // <bean id="abc" class="com.qf.annotation.People" />
@Scope(value = "prototype")
public class People {

    private String name = "李四";

    private Integer age = 24;

    @PostConstruct     // init-method
    public void init(){
        System.out.println("People的init方法！！");
    }

    @PreDestroy       // destroy-method
    public void destroy(){
        System.out.println("People的destroy方法！！");
    }

    public People() {
        System.out.println("People构建了！");
    }

    @Override
    public String toString() {
        return "People{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }
}
